from google.appengine.ext import db
from google.appengine.ext import search

class Beverage(search.SearchableModel):
    name = db.StringProperty(required=True)
    detail_url = db.LinkProperty()
    volume = db.IntegerProperty()
    caffeine_amount = db.IntegerProperty(required=True)
    caffeine_per_100ml = db.IntegerProperty()


class Intake(db.Model):
    user = db.UserProperty(required=True)
    beverage = db.ReferenceProperty(Beverage, required=True)
    timestamp = db.FloatProperty(required=True)

    # Cache of the Beverage value
    caffeine_amount = db.IntegerProperty(required=True)
